<div id="newsest-product" class="box">
    <div class="b-title">
        <div class="bt-wrapper">Sản phẩm mới nhất</div>
    </div>
    <div class="b-container">
        <?php
        try {
            if (isset($this->featuredCars) && count($this->featuredCars) > 0) {
                foreach ($this->featuredCars as $featuredCar) {
                    $arrImages = explode('@', $featuredCar->feature_image);
        ?>
                    <div class="product">
                        <a href="<?php echo $this->url(array("slug" => $featuredCar->slug), "post_view"); ?>" title="" >
                <?php
                    if (extension_loaded("gd") && function_exists("exec")) {
                ?>
                        <img src="<?php echo PUBLIC_URL . '/plugins/phpThumb/phpThumb.php?src=' . $arrImages[0] . '&amp;w=145&amp;h=95' ?>" alt="<?php echo $featuredCar->title ?>"/>
                <?php } else {
                ?>
                        <img src="<?php echo $arrImages[0]; ?>" alt="<?php echo $featuredCar->title ?>" width="145px" height="95px"/>
                <?php } ?>

                </a>
                <div>
                    <h4><a href="<?php echo $this->url(array("slug" => $featuredCar->slug), "post_view"); ?>"><?php echo $featuredCar->title; ?></a></h4>
                    <span class="price">Giá: <?php echo number_format($featuredCar->price); ?></span>
                    <span class="hot"></span>
                </div>
            </div>
        <?php
                }
            }
        } catch (Exception $ex) {
            echo $ex->getMessage();
        }
        ?>
        <div class="clearfix"></div>
    </div>
</div>
<?php
        if (isset($this->categories) && count($this->categories) > 0) {

            foreach ($this->categories as $category) {
                if (isset($category->cars) && count($category->cars) > 0) {
?>
                    <div  class="box">
                        <div class="b-title">
                            <div class="bt-wrapper"><?php echo $category->name; ?></div>
                        </div>
                        <div class="b-container">
        <?php
                    foreach ($category->cars as $car) {
                        $arrImages = explode('@', $car->feature_image);
        ?>
                        <div class="product">
                            <a href="<?php echo $this->url(array("slug" => $car->slug), "post_view"); ?>" title="" >
                <?php
                        if (extension_loaded("gd") && function_exists("exec")) {
                ?>
                            <img src="<?php echo PUBLIC_URL . '/plugins/phpThumb/phpThumb.php?src=' . $arrImages[0] . '&amp;w=145&amp;h=95' ?>" alt="<?php echo $car->title ?>"/>
                <?php } else {
                ?>
                            <img src="<?php echo $arrImages[0]; ?>" alt="<?php echo $car->title ?>" width="145px" height="95px"/>
                <?php } ?>
                    </a>
                    <div>
                        <h4><a href="<?php echo $this->url(array("slug" => $car->slug), "post_view"); ?>"><?php echo $car->title; ?></a></h4>
                        <span class="price">Giá: <?php echo number_format($car->price); ?></span>
                        <span class="hot"></span>
                    </div>
                </div>
        <?php
                    }
        ?>
                    <div class="readmore clearfix">
                        <a href="<?php echo $this->url(array("slug" => $category->slug), "category_view");?>">&raquo; Xem tất cả</a>
                    </div>
                </div>
            </div>
<?php
                }
            }
        }
?>